#include <iostream>
#include <vector>
using namespace std;

int dfs(vector<vector<int>> &area, int i, int j, int cs, int ps, vector<vector<int>> &dp);
int cal(vector<vector<int>> &area, int i, int ps, vector<vector<int>> &dp);

const int MOD = 100000000;

int get_status(int s, int j)
{
        return s & (1 << j);
}

int dfs(vector<vector<int>> &area, int i, int j, int cs, int ps, vector<vector<int>> &dp)
{
        if(j == area[0].size()){
                return cal(area, i + 1, cs, dp);
        }

        int ans = dfs(area, i, j + 1, cs, ps, dp);
        if(area[i][j] == 1 && (j == 0 || get_status(cs, j - 1) == 0) && get_status(ps, j) == 0){
                ans = (ans + dfs(area, i, j + 1, cs | (1 << j), ps, dp)) % MOD;
        }
        return ans;
}

int cal(vector<vector<int>> &area, int i, int ps, vector<vector<int>> &dp)
{
        if(i == area.size()){
                return 1;
        }

        if(dp[i][ps] != -1){
                return dp[i][ps];
        }

        int ans = dfs(area, i, 0, 0, ps, dp);
        return dp[i][ps] = ans;
}

int main()
{
        int n = 0, m = 0;
        cin >> n >> m;
        vector<vector<int>> area(n, vector<int>(m, 0));
        for(int i = 0; i < n; i++){
                for(int j = 0; j < m; j++){
                        cin >> area[i][j];
                }
        }

        vector<vector<int>> dp(n, vector<int>(1 << m, -1));

        cout << cal(area, 0, 0, dp) << endl;
        return 0;
}